<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
  	<link rel="stylesheet"
			href="${pageContext.request.contextPath}/css/base.css" />
	<link rel="stylesheet"
			href="${pageContext.request.contextPath}/css/info-reg.css" />
			
    <title>云云学习论坛--首页</title>
    <script type="text/javascript"
			src="${pageContext.request.contextPath }/js/jquery.js"></script>
	<script type="text/javascript">
	 window.onload=function(){
                //写入
                var oneInner = document.getElementById("div_id");
                oneInner.setAttribute("style","position:absolute;left:200px;top:100px;width:100px;height:100px;cursor:pointer;");
                var oneButton = document.createElement("input");
                oneButton.setAttribute("type","button");
                oneButton.setAttribute("value","x");
                if (oneButton.style.cssFloat)
                {
                    oneButton.style.cssFloat="right"
                }
                else
                {oneButton.style.styleFloat="right"}
                oneInner.appendChild(oneButton);
                document.body.appendChild(oneInner);
                //定时器
                var a1a = setInterval(moves,100);
                //函数
                var x = 10;
                var y = 10;
                function moves(){
                    var tops = oneInner.offsetTop
                    var lefts = oneInner.offsetLeft

                    if (lefts>=document.documentElement.clientWidth-oneInner.offsetWidth||lefts<=0)
                    {
                        x=-x
                    }

                    if (tops>=document.documentElement.clientHeight-oneInner.offsetHeight||tops<=0)
                    {
                        y=-y
                    }
                    tops+=y;
                    lefts+=x;
                    oneInner.style.top=tops+"px"
                    oneInner.style.left=lefts+"px"
                }
                //悬停停止
                oneInner.onmouseover=function(){
                    clearInterval(a1a);
                }
                //放手继续运动
                oneInner.onmouseout=function(){
                    a1a =setInterval(moves,100);
                }
                //删除
                oneButton.onclick=function(){
                    document.body.removeChild(oneInner);
                }
            }
	
	function back(){
	   var url = '${pageContext.request.contextPath}/home.jsp';
	   window.location.href = url;
	}
	
	function addSection(){
	 var url = '${pageContext.request.contextPath}/quzhi/forumManager/addSection.jsp';
	  window.location.href = url;
	}
	function modifySection(id){
	 var url = '${pageContext.request.contextPath}/ForumManager.action?method=queryByID&id='+id;
	 window.location.href = url;
	}
	function removeSection(id){
	 if(confirm("您确定要删除此版块吗！")){
	 var url = '${pageContext.request.contextPath}/ForumManager.action?method=removeSection&id='+id;
	 window.location.href = url;
	 }
	 
	}
	</script>		
    <style type="text/css">
     
      button{
       background-color: skyblue;
       cursor: pointer;color: navy;
      }
      body{
      
      background-image: url(${pageContext.request.contextPath}/images/forum4.jpg);
      }
      td{
      text-align: center;
      }
      lable{
      color: red;
      }
      .show{
      float: left;
      }
    </style>
  </head>
  <body style="overflow: hidden">  
   <div id="div_id" class="show">
    <img src="${pageContext.request.contextPath}/images/forum8.gif">
    </div>
   <input type="hidden" id="user_id" value="${login_User.userId}"/>
    	<div class="title" align="center">
			
			<h3 style="color: blue">欢迎<lable>${sessionScope.myUser.userName}</lable>进入公司内部小论坛。<lable>亲！当前拥有积分：${sessionScope.myUser.userPoint }.</lable>你可以在这里尽情发表你的想法！</h3>
		</div>
		<button onclick="back();">前往首页</button>
		<button onclick="addSection();">新增版块</button>
		
   <br/>
   <div class="sectiondiv">
    <table width="100%" align="center" cellpadding="0" cellspacing="0">
      <tr>
     	<td></td>
        <td>板块名称</td>
        <td>板块说明</td>
        <td>版块点击数</td>
        <td>版块主贴数</td>
        <td>我的操作</td>
      </tr>
      <c:forEach items="${requestScope.secList}" var="sec" varStatus="count">
       		<tr bgcolor="${count.index%2==0?'skyblue':'white' }">
       			<td><img  src="${pageContext.request.contextPath}/images/home.png"></td>
		        <td>
		        <a href="${pageContext.request.contextPath}/ForumManager.action?method=SectionClick&id=+${sec.secId}">${sec.secName}</a></td>
		        <td>${sec.secStatement }</td>
		        <td>${sec.secClickcount }</td>
		        <td>${sec.secTopiccount }</td>
		        <td>
		        <img  src="${pageContext.request.contextPath}/images/edtico.png">
		        <button onclick="modifySection(${sec.secId});">编辑版块</button>
		  		<button onclick="removeSection(${sec.secId});">版块去旧</button>
		        </td>
		     </tr>
      </c:forEach>
    </table>
   </div>  

  </body>
</html>
